{% extends 'blog/base.html' %}

{% block content %}

<div>
  <h2>Create new post</h2>

  {% if messages %}
  <ul>
    {% for message in messages %}
        <li>{{ message }}</li>
    {% endfor %}
  </ul>
  {% endif %}

  <form method="POST" action="{% url 'blog:create' %}">
    {% csrf_token %}

    {{ form.as_p }}

    <!-- TODO: show how field rendering works -->
    <!-- <div>
      {{ form.title.errors }}
      <label for="{{ form.title.id_for_label }}">
        {{ form.title.label }}
        <input
          type="text"
          name="{{ form.title.html_name }}"
          value="{{ form.title.value }}"
        />
      </label>
    </div> -->

    <button type="submit">Save</button>
  </form>
</div>
{% endblock %}
